<?php

/**
 * @author    Vtem.net
 * @copyright Copyright (C) 2011 Vtem.net. All rights reserved.
 * @license   GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
 */
// No direct access
defined('JPATH_BASE') or die;

jimport('joomla.html.html');
jimport('joomla.form.formfield');

class JFormFieldDates extends JFormField {

    protected $type = 'Dates';

    protected function getInput() {

        if ($this->element['name'] == 'cday' || $this->element['name'] == 'eday') {
            $attr = '';
            $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
            $days = array();
            for ($i = 0; $i <= 31; $i++) {

                $days[] = $i;
            }
            $html = array();

            if ($days) {
                for ($x = 0; $x < count($days); $x++) {
                    $html = JHtml::_('select.genericlist', $days, $this->name, trim($attr), 'id', 'name', 0);
                }
            }
        } else if ($this->element['name'] == 'cmonth' || $this->element['name'] == 'emonth') {
            $attr = '';
            $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
            $months = array();
            for ($i = 0; $i <= 12; $i++) {

                $months[] = $i;
            }
            $html = array();

            if ($months) {
                for ($x = 0; $x < count($months); $x++) {
                    $html = JHtml::_('select.genericlist', $months, $this->name, trim($attr), 'id', 'name', 0);
                }
            }
        }


        return $html;
    }

}